package tr.edu.metu.is.mega.client.widgets;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

/**
 * MEGA button component.
 */
public class MegaButton extends Button {

    private String featureIdentifier;

    /**
     * Default constructor.
     *
     * @param featureIdentifier feature identifier
     */
    public MegaButton(String featureIdentifier) {
        super();
        this.featureIdentifier = featureIdentifier;
    }

    /**
     * Creates a new MegaButton with the given text.
     *
     * @param featureIdentifier feature identifier
     * @param text the button text
     */
    public MegaButton(String featureIdentifier, String text) {
        super(text);
        this.featureIdentifier = featureIdentifier;
    }

    /**
     * Creates a new button with the given text and specified selection
     * listener.
     *
     * @param featureIdentifier feature identifier
     * @param text the button's text
     * @param listener the selection listener
     */
    public MegaButton(String featureIdentifier, String text,
            SelectionListener<ButtonEvent> listener) {
        this(featureIdentifier, text, null, listener);
    }

    /**
     * Creates a new MegaButton with the given text and iconStyle.
     *
     * @param featureIdentifier feature identifier
     * @param text the button text
     * @param icon the icon
     */
    public MegaButton(String featureIdentifier, String text,
            AbstractImagePrototype icon) {
        this(featureIdentifier, text, icon, null);
    }

    /**
     * Creates a new MegaButton with the given text, iconStyle and specified
     * selection listener.
     *
     * @param featureIdentifier feature identifier
     * @param text the button text
     * @param icon the icon
     * @param listener the selection listener
     */
    public MegaButton(String featureIdentifier, String text,
            AbstractImagePrototype icon, SelectionListener<ButtonEvent> listener) {
        super(text, icon, listener);
        this.featureIdentifier = featureIdentifier;
    }

    /**
     * Returns the feature identifier.
     *
     * @return the feature identifier
     */
    public String getFeatureIdentifier() {
        return featureIdentifier;
    }

}
